package adv4;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class CDate {
    public static void main(String[] args) {
        System.out.println(System.currentTimeMillis());
        Date d = new Date();
        System.out.println(d.getTime());
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        df.setLenient(false);//取消宽松格式
        Scanner in = new Scanner(System.in);
        System.out.println("请输入你的出生时间：");
        String str=in.nextLine();
        Date date = null;
        try {
            date = df.parse(str);
            System.out.println(date);
        } catch (ParseException e) {
            e.printStackTrace();
            //throw new RuntimeException(e);
        }

    }
}
